#include <REGX52.H>
#include "Delay.h"

sbit RCK = P3^5;	//将P34,P35,P36分别重命名为SER，RCK，SRCLK 
sbit SCK = P3^6;
sbit SER = P3^4;
#define LEDDZ_COL_PORT P0 //点阵列控制端口

void _74HC595(unsigned char den)
{
	unsigned char i=0;
	for(i=0;i<8;i++)
	{
		SER=den&(0x80>>i);	//0x80为1000 0000，如果den最高位也为1，则输出1000 0000
		SCK=1;			//RCK虽然只有一位，对应非0的数，自身也为1
		SCK=0;
	}
	RCK=1;
	RCK=0;
}

void LED_lattice_screen(unsigned char list,den)
{
	_74HC595(den);	
	LEDDZ_COL_PORT=~(0x80>>list);
	Delay(1);
	LEDDZ_COL_PORT=0xFF;
}

void main()
{
	SCK=0;
	RCK=0;	

	while(1)
	{
		LED_lattice_screen(0,0x3C);
		LED_lattice_screen(1,0x42);
		LED_lattice_screen(2,0xA9);
		LED_lattice_screen(3,0x85);
		LED_lattice_screen(4,0x85);
		LED_lattice_screen(5,0xA9);
		LED_lattice_screen(6,0x42);
		LED_lattice_screen(7,0x3C);
	}
}